repo.or.cz
/
andmenj-acm.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
Solving 10385 - Duathlon (Ternary search)
[andmenj-acm.git]
/
11513 - 9-Puzzle
/
genInput.rb
blob
033bf5a088e767f679a079f90f7b0ae4d3a9f43f
1
def permute_array(a)
2
1.upto(a.length - 1) do |i|
3
j = rand(i + 1)
4
a[i], a[j] = a[j], a[i]
5
end
6
a
7
end
8
9
for i in (1..1000) do
10
r = permute_array [1, 2, 3, 4, 5, 6, 7, 8, 9]
11
s = "#{r[0]} #{r[1]} #{r[2]}\n#{r[3]} #{r[4]} #{r[5]}\n#{r[6]} #{r[7]} #{r[8]}\n"
12
puts s
13
puts ""
14
end